package c.h.a.j0;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.RecyclerView.e;
import androidx.recyclerview.widget.RecyclerView.z;
import c.h.a.d0.g;
import c.h.a.m0.i;
import c.h.a.m0.k;
import com.liuzh.deviceinfo.DeviceInfoApp;
import java.util.ArrayList;
import java.util.List;

/* compiled from: TabThermal */
public class a1 extends h0 {
    public RecyclerView W;
    public HandlerThread X;
    public Handler Y;
    public List<g> Z = new ArrayList();
    public Runnable b0 = new a();
    public b c0;
    public ViewGroup d0;
    public View e0;
    public View f0;

    /* compiled from: TabThermal */
    public class a implements Runnable {
        public void run() {
            if (!a1.this.m0()) {
                a1 a1Var = a1.this;
                if (!(a1Var.W == null || a1Var.c0 == null)) {
                    c.h.a.m0.p.a.b(new f0(a1Var, k.Q()));
                }
                a1.this.Y.postDelayed(this, 2000);
            }
        }
    }

    /* compiled from: TabThermal */
    public class b extends e<a> {
        public LayoutInflater c;

        /* compiled from: TabThermal */
        public class a extends z {
            public TextView t;

            public a(b bVar, View view) {
                super(view);
                this.t = (TextView) view.findViewById(2131297034);
            }
        }

        public int a() {
            return a1.this.Z.size();
        }

        @SuppressLint({"SetTextI18n"})
        public void f(z zVar, int i) {
            g gVar = (g) a1.this.Z.get(i);
            TextView textView = ((a) zVar).t;
            StringBuilder stringBuilder = new StringBuilder();
            stringBuilder.append(gVar.a);
            stringBuilder.append("\n");
            stringBuilder.append(gVar.b);
            textView.setText(stringBuilder.toString());
        }

        public z g(ViewGroup viewGroup, int i) {
            if (this.c == null) {
                this.c = LayoutInflater.from(viewGroup.getContext());
            }
            return new a(this, this.c.inflate(2131492998, viewGroup, false));
        }
    }

    public void E(Bundle bundle) {
        super.E(bundle);
        HandlerThread handlerThread = new HandlerThread("TabThermalLoader");
        this.X = handlerThread;
        handlerThread.start();
        this.Y = new Handler(this.X.getLooper());
    }

    public View G(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        if (this.d0 == null) {
            this.d0 = (ViewGroup) layoutInflater.inflate(2131493061, viewGroup, false);
            i iVar = i.a;
            iVar = i.a;
            if (!i.b.getBoolean("rate_scene_clicked_tab_thermal", false)) {
                viewGroup = (ViewGroup) this.d0.findViewById(2131296475);
                View inflate = layoutInflater.inflate(2131492987, viewGroup, false);
                inflate.findViewById(2131296825).setOnClickListener(new g0(this, viewGroup, inflate));
                inflate.findViewById(2131296456).setOnClickListener(new e0(this, viewGroup, inflate));
                viewGroup.addView(inflate);
                viewGroup.setVisibility(0);
            }
            this.W = (RecyclerView) this.d0.findViewById(2131296829);
            this.e0 = this.d0.findViewById(2131296807);
            this.f0 = this.d0.findViewById(2131296552);
            b bVar = new b();
            this.c0 = bVar;
            this.W.setAdapter(bVar);
        }
        return this.d0;
    }

    public void H() {
        this.E = true;
        this.X.quitSafely();
    }

    public void N() {
        this.E = true;
        this.Y.removeCallbacks(this.b0);
    }

    public void P() {
        this.E = true;
        this.Y.removeCallbacks(this.b0);
        this.Y.post(this.b0);
    }

    public String r0() {
        return DeviceInfoApp.c.getString(2131690447);
    }
}
